builder-tool: Translate GtkImage:pixbuf
authorMatthias Clasen <mclasen@redhat.com>
Wed, 27 Jan 2021 22:01:51 +0000 (17:01 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 27 Jan 2021 22:01:51 +0000 (17:01 -0500)
The pixbuf property doesn't exist anymore. It is
commonly set to a path in ui files, so translate it
to the file property.

gtk/tools/gtk-builder-tool-simplify.c
testsuite/tools/simplify-data-3to4/image.expected [new file with mode: 0644]
testsuite/tools/simplify-data-3to4/image.ui [new file with mode: 0644]

index b61487c53774e3a1ae25535dea78b1c7e433939e..990377bd212d4288489734f4c7fbcb22e504c83e 100644 (file)
@@ -719,7 +719,8 @@ maybe_rename_property (Element *element, MyParserData *data)
     { "GtkWidget", "margin-right", GTK_TYPE_WIDGET, PROP_KIND_OBJECT, "margin-end", { NULL, NULL, NULL } },
     { "GtkHeaderBar", "show-close-button", GTK_TYPE_HEADER_BAR, PROP_KIND_OBJECT, "show-title-buttons", { NULL, NULL, NULL } },
     { "GtkHeaderBar", "custom-title", GTK_TYPE_HEADER_BAR, PROP_KIND_OBJECT, "title-widget", { NULL, NULL, NULL } },
-    { "GtkStack", "homogeneous", GTK_TYPE_STACK, PROP_KIND_OBJECT, "hhomogeneous", { "vhomogeneous", NULL, NULL } }
+    { "GtkStack", "homogeneous", GTK_TYPE_STACK, PROP_KIND_OBJECT, "hhomogeneous", { "vhomogeneous", NULL, NULL } },
+    { "GtkImage", "pixbuf", GTK_TYPE_IMAGE, PROP_KIND_OBJECT, "file", { NULL, NULL, NULL } },
   };
   int i, k, l;
   PropKind kind;
diff --git a/testsuite/tools/simplify-data-3to4/image.expected b/testsuite/tools/simplify-data-3to4/image.expected
new file mode 100644 (file)
index 0000000..ccb3491
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk" version="4.0"/>
+  <object class="GtkWindow">
+    <property name="child">
+      <object class="GtkImage">
+        <property name="visible">0</property>
+        <property name="file">test.svg</property>
+      </object>
+    </property>
+  </object>
+</interface>
diff --git a/testsuite/tools/simplify-data-3to4/image.ui b/testsuite/tools/simplify-data-3to4/image.ui
new file mode 100644 (file)
index 0000000..0aebe4e
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow">
+    <child>
+      <object class="GtkImage">
+        <property name="pixbuf">test.svg</property>
+      </object>
+    </child>
+  </object>
+</interface>